package random;

import java.util.Random;

public class Exercise {
    public static void main(String[] args) {

       // method01();
        char ch='a';
        char[] chars = new char[26];
        for (int i = 0; i < 26; i++) {
            chars[i] = ch;
            ch++;
        }
    /*    for (int i = 0; i < chars.length; i++) {
            System.out.println(chars[i]);
        }*/
        Random random = new Random();
        //StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            int index = random.nextInt(chars.length);//[0,25)
           // sb.append(chars[index]);
            System.out.print(chars[index]);
        }
       // System.out.println(sb);


    }

    private static void method01() {
        char[] chars = new char[26];
        char ch = 'a';

        for (int i = 0; i < chars.length; i++) {
            chars[i] = ch;
            ch++;
        }
    /*    for (int i = 0; i < chars.length; i++) {
            System.out.println(chars[i]);
        }*/

        Random random = new Random();
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < 4; i++) {
            int index = random.nextInt(chars.length);
            sb.append(chars[index]);
        }
        System.out.println(sb);
    }
}
